<?php
namespace model;
use \core\Model;
class CategoryModel extends Model{
    public function recursiveCat(&$tree,$categorys,$c_id=0,$level=0){
        foreach ($categorys as $k=>$category){
            if($category['parent_id']==$c_id){
                $category['level']=$level;
                $tree[]=$category;

                $this->recursiveCat($tree,$categorys,$category['id'],$level+1);
            }
        }
    }
}

